<?php
 session_start();
 include("include/session.php");
 include("include/common.php");
 include("include/db.php");

 $sqlOrder = mysql_query("SELECT * FROM `prool_order` WHERE random_order_id = '".$_REQUEST['order_id']."'");
 $resOrder = mysql_fetch_array($sqlOrder);
 
 $sqlCategory = mysql_query("SELECT * FROM prooll_category WHERE active = 'Y'");
 while($resCategory = mysql_fetch_array($sqlCategory))
	$category[$resCategory["category_id"]]	= $resCategory["category_name"];
	
 $sqlCountry = mysql_query("SELECT * FROM prooll_country WHERE status = 'Y'");
 while($resCountry = mysql_fetch_array($sqlCountry))
	$country[$resCountry["country_code"]]	= $resCountry["country_name"];
 
 if(isset($_REQUEST['send_email']) && $_REQUEST['send_email'] == 1){
		
		$sqlOrdProfiles = mysql_query("SELECT * FROM prool_order_product as OP 
													WHERE order_id = '".$_REQUEST['order_id']."'");
		while($resOrdProfiles = mysql_fetch_array($sqlOrdProfiles)){
			
			if($resOrdProfiles["product_name"] > 0)
			{
		
					
				$sqlProfile = mysql_query("SELECT * FROM prooll_employee_profile where profile_id  = '".intval($resOrdProfiles["product_name"])."'");
				$resProfile = mysql_fetch_array($sqlProfile);
				
				$htmlFormat = '<style type="text/css">
							.text {font-family: Arial, Helvetica, sans-serif; font-size: 12px; color:#F64700 }
							.heading_bold_black
							{
								font-family: Arial, "MS Sans Serif";
								font-size: 14px;
								color: #000000;
								font-weight: bold;
							}
							.brd {
								BORDER-RIGHT: #000000 1px solid; 
								BORDER-TOP: #000000 1px solid; 
								BORDER-LEFT: #000000 1px solid; 
								BORDER-BOTTOM: #000000 1px solid; 
								border-color: #3399CC;
							}
							.style1 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; }
						</style>
							<table width="800" align="center" cellpadding="0" cellspacing="0" style="background-color:#F7FAFF; color:#F64700"  >						
								<div style="width:500px;background-color:#E3EFFD; color:#F64700" >
										<div style="margin-bottom:20px" ><strong>User Profile</strong></div>
										<div style="width:100%; height:35px "   >
											<div class="text" style="float:left; width:30%; padding-left:50px" align="left" >First Name</div>
											<div class="text" style="float:left" >'.$resProfile['first_name'].'</div>
											<div style="clear:both" ></div>
										</div>
										<div style="width:100%; height:35px "   >
											<div class="text" style="float:left; width:30%; padding-left:50px" align="left" >Last Name</div>
											<div class="text" style="float:left" >'.$resProfile['last_name'].'</div>
											<div style="clear:both" ></div>
										</div>
										<div style="width:100%; height:35px "   >
											<div class="text" style="float:left; width:30%; padding-left:50px" align="left" >Mobile Number</div>
											<div class="text" style="float:left" >'.$resProfile['mobile'].'</div>
											<div style="clear:both" ></div>
										</div>
										<div style="width:100%; height:35px "   >
											<div class="text" style="float:left; width:30%; padding-left:50px" align="left" >Phone Number</div>
											<div class="text" style="float:left" >'.$resProfile['phone'].'</div>
											<div style="clear:both" ></div>
										</div>
										<div style="width:100%; height:35px "   >
											<div class="text" style="float:left; width:30%; padding-left:50px" align="left" >Email Address</div>
											<div class="text" style="float:left" >'.$resProfile['email_address'].'</div>
											<div style="clear:both" ></div>
										</div>
										<div style="width:100%; height:35px "   >
											<div class="text" style="float:left; width:30%; padding-left:50px" align="left" >Employee Address</div>
											<div class="text" style="float:left" >'.$resProfile['address'].'</div>
											<div style="clear:both" ></div>
										</div>
										<div style="width:100%; height:35px "   >
											<div class="text" style="float:left; width:30%; padding-left:50px" align="left" >Employee Address2</div>
											<div class="text" style="float:left" >'.$resProfile['address2'].'</div>
											<div style="clear:both" ></div>
										</div>
										<div style="width:100%; height:35px "   >
											<div class="text" style="float:left; width:30%; padding-left:50px" align="left" >Employee City</div>
											<div class="text" style="float:left" >'.$resProfile['city'].'</div>
											<div style="clear:both" ></div>
										</div>
										<div style="width:100%; height:35px "   >
											<div class="text" style="float:left; width:30%; padding-left:50px" align="left" >Employee State</div>
											<div class="text" style="float:left">'.$resProfile['state'].'</div>
											<div style="clear:both" ></div>
										</div>
										<div style="width:100%; height:35px "   >
											<div class="text" style="float:left; width:30%; padding-left:50px" align="left" >Employee Country</div>
											<div class="text" style="float:left" >'.$country[$resProfile['country']].'</div>
											<div style="clear:both" ></div>
										</div>
										<div style="width:100%; height:35px "   >
											<div class="text" style="float:left; width:30%; padding-left:50px" align="left" >Employee Category</div>
											<div class="text" style="float:left" >'.$category[$resProfile['category']].'</div>
											<div style="clear:both" ></div>
										</div>
										<div style="width:100%; height:35px "   >
											<div class="text" style="float:left; width:30%; padding-left:50px" align="left" >Employee Degree</div>
											<div class="text" style="float:left" >'.$resProfile['degree'].'</div>
											<div style="clear:both" ></div>
										</div>
										<div style="width:100%; height:35px "   >
											<div class="text" style="float:left; width:30%; padding-left:50px" align="left" >Job Occupation</div>
											<div class="text" style="float:left">'.$resProfile['job_occupation'].'</div>
											<div style="clear:both" ></div>
										</div>
										<div style="width:100%; height:35px "   >
											<div class="text" style="float:left; width:30%; padding-left:50px" align="left" >Job Experiencce</div>
											<div class="text" style="float:left" >'.$resProfile['job_experience'].'</div>
											<div style="clear:both" ></div>
										</div>
										<div style="width:100%; height:35px "   >
											<div class="text" style="float:left; width:30%; padding-left:50px" align="left" >Current Company Name</div>
											<div class="text" style="float:left" >'.$resProfile['current_company_name'].'</div>
											<div style="clear:both" ></div>
										</div>
										<div style="width:100%; height:35px "   >
											<div class="text" style="float:left; width:30%; padding-left:50px" align="left" >Experience in current company</div>
											<div class="text" style="float:left" >'.$resProfile['exprience_current_company'].'</div>
											<div style="clear:both" ></div>
										</div>
										<div style="width:100%; height:35px "   >
											<div class="text" style="float:left; width:30%; padding-left:50px" align="left" >Current Designation</div>
											<div class="text" style="float:left" >'.$resProfile['current_designation'].'</div>
											<div style="clear:both" ></div>
										</div>
										<div style="width:100%; height:35px "   >
											<div class="text" style="float:left; width:30%; padding-left:50px" align="left" >Other Company Name</div>
											<div class="text" style="float:left">'.$resProfile['other_company_name'].'</div>
											<div style="clear:both" ></div>
										</div>
										<div style="width:100%; height:35px "   >
											<div class="text" style="float:left; width:30%; padding-left:50px" align="left" >Objective</div>
											<div class="text" style="float:left" >'.$resProfile['objective'].'</div>
											<div style="clear:both" ></div>
										</div>
										<div style="width:100%; "   >
											<div class="text" style="float:left; width:30%; padding-left:50px" align="left" >Comments</div>
											<div class="text" style="float:left; width:45%" align="left" >'.nl2br($resProfile['description']).'</div>
											<div style="clear:both" ></div>
										</div>
									</div>								
							</table>';
				
				//echo $htmlFormat;
				
				// Always set content-type when sending HTML email
				$headers = "MIME-Version: 1.0" . "\r\n";
				$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";// More headers
				$headers .= "From: Prooll.com \r\n";
				
				mail($resOrder["s_email"] , "You have got profile from Prooll.com" , $htmlFormat , $headers);
 				
 		}
 	}
 }
 
 
 ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?=TITLE_WEBSITE?></title>
<link href="css/c_energy.css" rel="stylesheet" type="text/css" />
<link href="css/logo.css" rel="stylesheet" type="text/css" />
<script src="hola_script.js" type="text/javascript"></script>

<script src="include/AjaxQuery.js" type="text/javascript"></script>
<script type="text/javascript">
</script>
<style type="text/css">
<!--
.style4 {
	font-size: 22px;
	font-weight: bold;
}
.style6 {color: #999999}
-->
</style>
</head>

<body>

    <table width="990" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td colspan="3" align="left" valign="top" ><? require("header.php");?></td>
</tr>
  <tr>
    <td align="center" >
	<table width="99%" cellspacing="0" cellpadding="0">
      <tr>
        <td colspan="3" align="center" valign="top">&nbsp;</td>
      </tr>
       <tr bgcolor="#FAFAFA">
        <td colspan="0" align="left" valign="top" >
		   <table width="96%" cellspacing="0" cellpadding="0">
		    <tr>
		      <td width="2%" align="left" valign="top" style="padding-left:15px" ><? require("left.php");?></td>
		      <td width="94%"  valign="top" style="padding-left:15px" >
			  <form name="signform" action="" method="post" enctype="multipart/form-data" id="signform" onsubmit="return validation();" >
			    <table id="signInTbl" width="719" cellspacing="0" cellpadding="0" style="border:solid #cccccc 1px">
                  <tr>
                    <td colspan="6" align="left" bgcolor="#373737" class="loc_search_found_term"  style="border-bottom:solid #cccccc 1px">Order</td>
                  </tr>
           		 <tr  height="25">
                 			<td colspan="6">
                            	<table  >
                                	<tr bgcolor="#D5F5FD"  >
                                    	<td width="50px" align="left" style="color:#000000" ><strong>Order :</strong></td>
                                        <td width="200" align="left"style="color:#000000" ><strong><?=$resOrder["random_order_id"]?></td>
                                        <td width="50" align="left" style="color:#000000" ><strong>Amount</strong></td>
                                        <td width="100" align="left" style="color:#000000" ><?=$resOrder["amount"]?></td>
                                        <td width="100" align="left" style="color:#000000" ><strong>Status</strong> </td>
                                        <td width="150" align="left" style="color:#000000" ><?=($resOrder["status"] == 'N' ? 'Non-Active' : 'Active')?> </td>
                                        <td width="170" align="left" style="color:#000000" ><strong><?=date("Y-m-d H:i:s",$resOrder["time_id"])?></strong> </td>
                                    </tr>
                                
                                	<tr bgcolor="#D5F5FD"  >
                                    	<td width="600" align="right" colspan="7" style="color:#000000" ><strong><a href="view_order.php?order_id=<?=$_REQUEST['order_id']?>&send_email=1" style="color:#333333;" >Send Email</a></strong></td>
                                    
                                    </tr>
                                </table>
                        </td>
                  </tr>
                  <tr style="background: #BDF319 " height="25">
                 	<td colspan="6"><div align="left" id="err_site" style="display:block; color:#FFFFFF">
                      <strong>&nbsp;&nbsp;Shipping Information</strong>
                    </div></td>
                  </tr>
                  
				  <tr height="30">
                    <td width="139" align="left" style="padding-left:15px"><strong>First Name</strong></td>
                    <td align="left" colspan="4"><?=$resOrder["s_firt_name"]?></td>
                  </tr>
                  <tr height="30">
                    <td width="139" align="left" style="padding-left:15px"><strong>Last Name</strong></td>
                    <td align="left" colspan="4"><?=$resOrder["s_last_name"]?></td>
                  </tr>
                  <tr height="30">
                    <td width="139" align="left" style="padding-left:15px"><strong>Address</strong></td>
                    <td align="left" colspan="4"><?=$resOrder["s_address1"]?></td>
                  </tr>
                  <tr height="30">
                    <td width="139" align="left" style="padding-left:15px"><strong>Address 2</strong></td>
                    <td align="left" colspan="4"><?=$resOrder["s_address2"]?></td>
                  </tr>
                  <tr height="30">
                    <td width="139" align="left" style="padding-left:15px"><strong>Phone Number</strong></td>
                    <td align="left" colspan="4"><?=$resOrder["s_phone_number"]?></td>
                  </tr>
                  <tr height="30">
                    <td width="139" align="left" style="padding-left:15px"><strong>Mobile Number</strong></td>
                    <td align="left" colspan="4"><?=$resOrder["s_mobile_number"]?></td>
                  </tr>
                  <tr height="30">
                    <td width="139" align="left" style="padding-left:15px"><strong>Province</strong></td>
                    <td align="left" colspan="4"><?=$resOrder["s_province"]?></td>
                  </tr>
                  <tr height="30">
                    <td width="139" align="left" style="padding-left:15px"><strong>City</strong></td>
                    <td align="left" colspan="4"><?=$resOrder["s_city"]?></td>
                  </tr>
                    <tr height="30">
                    <td width="139" align="left" style="padding-left:15px"><strong>Country</strong></td>
                    <td align="left" colspan="4"><?=$resOrder["s_country"]?></td>
                  </tr>
                  <tr style="background: #BDF319 " height="25">
                 	<td colspan="6"><div align="left" id="err_site" style="display:block; color:#FFFFFF">
                      <strong>&nbsp;&nbsp;Payment Information</strong>
                    </div></td>
                  </tr>
                  
				  <tr height="30">
                    <td width="139" align="left" style="padding-left:15px"><strong>First Name</strong></td>
                    <td align="left"  colspan="4"><?=$resOrder["p_firt_name"]?></td>
                  </tr>
                  <tr height="30">
                    <td width="139" align="left" style="padding-left:15px"><strong>Last Name</strong></td>
                    <td align="left"  colspan="4"><?=$resOrder["p_last_name"]?></td>
                  </tr>
                  <tr height="30">
                    <td width="139" align="left" style="padding-left:15px"><strong>Address</strong></td>
                    <td align="left"  colspan="4"><?=$resOrder["p_address1"]?></td>
                  </tr>
                  <tr height="30">
                    <td width="139" align="left" style="padding-left:15px"><strong>Address 2</strong></td>
                    <td align="left"  colspan="4"><?=$resOrder["p_address2"]?></td>
                  </tr>
                  <tr height="30">
                    <td width="139" align="left" style="padding-left:15px"><strong>Phone Number</strong></td>
                    <td align="left"  colspan="4"><?=$resOrder["p_phone_number"]?></td>
                  </tr>
                  <tr height="30">
                    <td width="139" align="left" style="padding-left:15px"><strong>Mobile Number</strong></td>
                    <td align="left"  colspan="4"><?=$resOrder["p_mobile_number"]?></td>
                  </tr>
                  <tr height="30">
                    <td width="139" align="left" style="padding-left:15px"><strong>Province</strong></td>
                    <td align="left"  colspan="4"><?=$resOrder["p_province"]?></td>
                  </tr>
                  <tr height="30">
                    <td width="139" align="left" style="padding-left:15px"><strong>City</strong></td>
                    <td align="left"  colspan="4"><?=$resOrder["p_city"]?></td>
                  </tr>
                    <tr height="30">
                    <td width="139" align="left" style="padding-left:15px"><strong>Country</strong></td>
                    <td align="left"  colspan="4"><?=$resOrder["p_country"]?></td>
                  </tr>
                  <tr style="background: #BDF319 " height="25">
                 	<td colspan="6"><div align="left" id="err_site" style="display:block; color:#FFFFFF">
                      <strong>&nbsp;&nbsp;Product Information</strong>
                    </div></td>
                  </tr>
					<tr bgcolor="#373737"  >
						<td width="139" align="left" style="color:#FFFFFF" ><strong>First Name</strong></td>
						<td width="206" align="left"style="color:#FFFFFF" ><strong>Mobile</strong></td>
						<td width="150" align="left" style="color:#FFFFFF" ><strong>Email</strong></td>
						<td width="171" align="left" style="color:#FFFFFF" ><strong>Address</strong></td>
						<td width="51" align="left" style="color:#FFFFFF" ><strong>Category</strong> </td>
					</tr>
                               
                  <?php
				  										
                  	$sqlOrderProducts = mysql_query("SELECT OP.*,first_name,mobile,email_address,address,category  
															FROM prool_order_product as OP 
																   INNER JOIN prooll_employee_profile as P ON P.profile_id = OP.product_name 
																   
                           							    	WHERE order_id = '".$_REQUEST['order_id']."'");
					while($resOrderProducts = mysql_fetch_array($sqlOrderProducts))
					{		
				  ?>
            		<tr <?=preg_match("/1$|3$|5$|7$|9$/",$i++) ? "bgcolor='#E3F8FD'" : "bgcolor='#FFFFFF'"?>>
						<td width="139" align="left" ><strong><?=$resOrderProducts["first_name"]?></strong></td>
						<td align="left" ><?=$resOrderProducts["mobile"]?></td>
						<td align="left" ><?=$resOrderProducts["email_address"]?></td>
						<td align="left" ><?=$resOrderProducts["address"]?></td>
						<td align="left" ><?=$category[$resOrderProducts["category"]]?></td>
					</tr>
                  <?php
                  	}
				  ?>
                  
                </table>
			    <p>&nbsp;</p>
			  </form>			  </td>
            </tr>
	        </table></td>
        </tr>
      <tr bgcolor="#FAFAFA">
        <td width="800" align="center" valign="top">&nbsp;</td>
        <td width="100" colspan="2">&nbsp;</td>
      </tr>
	    <tr bgcolor="#FAFAFA">
        <td width="800" align="center" valign="top">&nbsp;</td>
        <td colspan="2">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>

